package Phase;

import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;

public class JDoubleBufferedPanel extends JPanel{
    private Image image;
    
    public JDoubleBufferedPanel (){
        super();
        this.setFocusable(true);
    }
    
    @Override
    public void paint(Graphics g){
        update(g);
    }
    
    @Override
    public void update(Graphics g){
        g.drawImage(image, 0, 0, this);
    }
    
    public Image getImage(){
        image = createImage(this.getWidth(), this.getHeight());
        return image;
    }
}
